feat: add messaging gateway pattern support#299
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds first-class Messaging Gateway support to PatternKit’s messaging slice: a runtime typed request/response facade over MessageChannel<T>, plus a Roslyn generator + attributes to generate DI-friendly gateway factories. It also expands the example + documentation catalogs and adds TinyBDD coverage across runtime, generator, and examples.
Changes:
- Introduces
MessagingGateway<TRequest, TResponse>runtime API and result model inPatternKit.Core. - Adds
[GenerateMessagingGateway]/[MessagingGatewayHandler]abstractions +MessagingGatewayGeneratorwith diagnosticsPKGWY001-003. - Adds payment authorization gateway example (fluent + generated), DI import paths, catalog entries, docs, and tests.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/Messaging/Gateways/MessagingGatewayTests.cs | Adds runtime gateway behavior tests (success, rejection, builder validation). |
| test/PatternKit.Generators.Tests/MessagingGatewayGeneratorTests.cs | Adds generator tests for source output + diagnostics. |
| test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs | Extends attribute coverage tests for new gateway attributes. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs | Updates expected catalog pattern set/count for new Messaging Gateway entry. |
| test/PatternKit.Examples.Tests/Messaging/PaymentMessagingGatewayExampleTests.cs | Adds example validation (fluent vs generated + DI imports). |
| src/PatternKit.Generators/Messaging/MessagingGatewayGenerator.cs | Implements the incremental source generator and diagnostics for gateways. |
| src/PatternKit.Generators/AnalyzerReleases.Unshipped.md | Documents new analyzer diagnostic IDs PKGWY001-003. |
| src/PatternKit.Generators.Abstractions/Messaging/MessagingGatewayAttributes.cs | Adds generator attribute definitions for gateway generation. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs | Registers Messaging Gateway in the pattern catalog with related assets. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs | Registers “Payment Messaging Gateway” example descriptor. |
| src/PatternKit.Examples/Messaging/PaymentMessagingGatewayExample.cs | Adds payment authorization gateway demo (fluent + generated + DI). |
| src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs | Wires the new example into AddPatternKitExamples() and adds an example service record. |
| src/PatternKit.Core/Messaging/Gateways/MessagingGateway.cs | Adds the runtime gateway + result types. |
| docs/patterns/toc.yml | Adds Messaging Gateway to patterns TOC. |
| docs/patterns/messaging/README.md | Adds Messaging Gateway section and link. |
| docs/patterns/messaging/messaging-gateway.md | Adds new Messaging Gateway pattern documentation page. |
| docs/guides/pattern-coverage.md | Adds Messaging Gateway to the pattern coverage matrix. |
| docs/generators/toc.yml | Adds Messaging Gateway generator docs to TOC. |
| docs/generators/messaging-gateway.md | Adds generator usage + diagnostics documentation. |
| docs/generators/index.md | Adds Messaging Gateway to generator index table. |
| docs/examples/toc.yml | Adds Payment Messaging Gateway example to examples TOC. |
| docs/examples/payment-messaging-gateway.md | Adds new example documentation page. |
| docs/examples/index.md | Adds Payment Messaging Gateway to examples index list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| public MessagingGatewayResult<TRequest, TResponse> Invoke(TRequest request, MessageContext? context = null) | ||
| { | ||
| var requestMessage = Message<TRequest>.Create(request); |
Test Results 1 files 1 suites 2m 13s ⏱️ Results for commit 9d21033. |
Code Coverage |
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #299 +/- ##
==========================================
+ Coverage 90.34% 96.04% +5.70%
==========================================
Files 416 420 +4
Lines 35407 35581 +174
Branches 5010 5039 +29
==========================================
+ Hits 31987 34174 +2187
+ Misses 1515 1407 -108
+ Partials 1905 0 -1905
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #293.
Summary
Validation
MessagingGatewayGeneratorTests|FullyQualifiedNameAbstractionsAttributeCoverageTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=falseMessagingGatewayGeneratorTests|FullyQualifiedNameAbstractionsAttributeCoverageTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=falseLocal examples build remains blocked by the existing analyzer/compiler mismatch (CS9057) and generated demo types; hosted CI remains authoritative for examples/docs.